const path = require('path');
module.exports = {
    pages: {
        index: {
            entry: 'src/main.js',
            template: 'public/index.html',
            filename: 'index.html'
        }
    },
    chainWebpack: config => {
        config.resolve.alias
            .set('@', path.join(__dirname, 'src'))
            .set('static', path.join(__dirname, 'public/static'))
        config.module
            .rule('js')
            .include
            .add('/packages')
            .end()
            .use('babel')
            .loader('babel-loader')
            .tap(options => {
                return options
            })
    },
    css: {
      extract: false
    },
    // 打包时移除.map文件
    productionSourceMap: false,
    devServer: {
        hot: true,
        overlay: {
            // 显示在页面上
            warnings: false,
            errors: true
        },
        proxy: {
            '/lifeSite': {
                target: 'http://127.0.0.1:3000/lifeSite/',
                changeOrigin: true,
                pathRewrite: {
                    '^/lifeSite': '/'
                }
            },
            '/yun': {
                target: 'http://127.0.0.1:3000/yun/',
                changeOrigin: true,
                pathRewrite: {
                    '^/yun': '/'
                }
            }
        }
    }
}
